import 'package:flutter/material.dart';

class NavigatorUtil {
  NavigatorUtil._();

  /// 返回
  static void goBack(BuildContext context, [Map<String, dynamic>? result]) {
    unFocus();
    Navigator.pop(context, result);
  }

  // 可能返回
  static Future<bool> maybePop(BuildContext context, [result]) {
    return Navigator.maybePop(context, result);
  }

  static void unFocus() {
    if (FocusManager.instance.primaryFocus?.hasFocus ?? false) {
      FocusManager.instance.primaryFocus?.unfocus();
    }
  }
}
